﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApplication1.Model;
using WindowsFormsApplication1.DAL;
using WindowsFormsApplication1.BLL;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Person p1 = new Person();
            //p1.Age = 60;
            //p1.Name = "江泽民";
            //int id = new PersonDAL().addNew(p1);
            //MessageBox.Show(id.ToString());

            //PersonDAL pd = new PersonDAL();
            //Person p1 = pd.GetPerson(1);
            //p1.Name = "王宝三";
            //pd.update(p1);

            //UI不能直接调用DAL层....
            PersonBLL pb = new PersonBLL();
            Person p1 = pb.GetPerson(1);
            p1.Age = 59;
            pb.update(p1);

            dataGridView1.DataSource = new PersonBLL().GetAll();
        }

    }
}
